package com.example.springboot01.execs;

import com.example.springboot01.resp.Response;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(CustomException.class)
    public Response onOccurException(CustomException ex) {
        return Response.error(ex.getCode(), ex.getMessage());
    }
}
